Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement bond order syntax for CG #24

Merged
merged 7 commits into from
Oct 16, 2024
Merged

implement bond order syntax for CG #24

merged 7 commits into from
Oct 16, 2024

Conversation

fgrunewald
Copy link
Collaborator

Some important changes:

  • Implements bond orders for CG using . = $ etc.
  • Multiedges are dropped
  • Bonds with order 0 are not resolved
  • Nodes that only have zero-order bonds are not resolved

This should allow the capturing of virtual sides. The idea is that a VS has only non-zero order if it corresponds to a real fragment. In this case, it is a user's choice how many edges with zero order one provides on top of that. Any edges required to reconstruct the molecule are still mandatory.

Let's look at some examples:

  • Glucose has one VS TC4 which sits in the middle of the triangle so it has 3 zero edges and no fragment.
    {[#SP4]1.2[#SP4].3[#SP1r]1.[#TC4]23}.{#SP4=OC[$]C[$]O,#SP1r=[$]OC[$]CO}

  • Naphthalene has one VS in the middle of the ring TC5A here. We don't care because it has connectivity to all it's constructing neighboring atoms.
    {[#TC5]1[#TC5B][#TC5A]12[#TC5][#TC5B]2}.{#TC5B=[$]cc[>],#TC5=[$]cc[<],#TC5A=[>][>]cc[<][<]}

  • Polythiophene has two VS that connect the rings at the CG level. The CG graph could either write this edge and all constructing edges or connect the VS only to one anchor. In any case, the connection between #C has to be provided in all cases. There is no way to recover the CG connectivity in a sensible way as it dos not map from the all-atom level. This is the best we can do.
    -{[#A]1[#B][#C]12.[#VS].[#VS].[#C]12[#B][#A]1}
    -{[#A]12[#B]3[#C]14.[#VS]23.[#VS]23.[#C]14[#B]2[#A]31}

@fgrunewald fgrunewald requested a review from pckroon October 14, 2024 11:48
@pckroon
Copy link
Collaborator

pckroon commented Oct 14, 2024

Should the last 2 examples be:

  • {[#A]1[#B][#C]12.[#VS][#VS].[#C]12[#B][#A]1}
  • {[#A]12[#B]3[#C]14.[#VS].2.3[#VS].2.3.[#C]14[#B]2[#A]31}
    ?

Copy link
Collaborator

@pckroon pckroon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, just some small commetns

cgsmiles/read_cgsmiles.py Show resolved Hide resolved
cgsmiles/resolve.py Outdated Show resolved Hide resolved
cgsmiles/resolve.py Outdated Show resolved Hide resolved
cgsmiles/resolve.py Outdated Show resolved Hide resolved
cgsmiles/tests/test_cgsmile_parsing.py Show resolved Hide resolved
@fgrunewald fgrunewald requested a review from pckroon October 14, 2024 17:20
Copy link
Collaborator

@pckroon pckroon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nitpicks

cgsmiles/read_cgsmiles.py Outdated Show resolved Hide resolved
cgsmiles/read_cgsmiles.py Outdated Show resolved Hide resolved
cgsmiles/resolve.py Outdated Show resolved Hide resolved
@fgrunewald fgrunewald requested a review from pckroon October 16, 2024 09:55
Copy link
Collaborator

@pckroon pckroon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Left to do is for you to decide what %123 means

@fgrunewald
Copy link
Collaborator Author

@pckroon %123 means ID 123. I foresee that there will be no use case of more than 10 ring IDs.

@fgrunewald fgrunewald merged commit ad9844c into master Oct 16, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants